<?php

FUNCTION echo_result($gamelist)
{	
	if(!$gamelist) {echo "<th>result not valid</th>"; }
	 else {
    $i = 0;
	echo "</tr>";
	echo "<table width='500' align='center' border='4' cellspacing='0' cellpadding='0'  bgcolor='#F0FFFF'><tr>";	
    while ($i < mysql_num_fields($gamelist)) 
	{
      $field = mysql_fetch_field($gamelist, $i);
      echo "<th>".$field->name."</th>";
      $i++;
    }
    echo "</tr>";

	
	while($row = mysql_fetch_array($gamelist)){
		echo "<tr align='center'>";
		if(isset($row["title"]))
		$game_id=get_game_id($row['title']); 
		echo "<td><a href=\"showGameDetails.php?selection=$game_id\">" . $row["title"] . "</a></td>";
		if(isset($row["release_date"]))
		echo "<td>" . $row["release_date"] . "</td>";
		if(isset($row["category"]))
		echo "<td>" . $row["category"] . "</td>";
		if(isset($row["rate"]))
		echo "<td>" . $row["rate"] . "</td>";
		echo "</tr>";
	}
}
	echo "</table>";
} 
?>